﻿@model EmgrMvc.ViewModels.DeviceGroupView

@{
    ViewData["Title"] = "Details";
}

<h2>Details</h2>

<div>
    <h4>DeviceGroup</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.group.Name)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.group.Name)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.group.Description)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.group.Description)
        </dd>
    </dl>
</div>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.group.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.group.Description)
            </th>
            <th>
                状态
            </th>
            <th>
                最近时间
            </th>

            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model.groupDevices)
        {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Latest)
            </td>
            <td>
                <a asp-action="RemoveDevice" asp-route-id="@Model.group.Id" asp-route-deviceid="@item.Id">Delete</a>
            </td>
        </tr>
        }
    </tbody>
</table>
<div>
    <a asp-action="Edit" asp-route-id="@Model.group.Id">Edit</a> |
    <a asp-action="Index">Back to List</a>
    <form asp-action="AddDevice" method="post">
        <input type="hidden" id="id" name="id" value="@Model.group.Id" />
        <select name="DeviceWillAdd" asp-items="ViewBag.AllDevices"  class="form-control"></select>
        <button type="submit" value="Add"  >Add Device to This Group</button>
    </form>
</div>
